﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Helpers.Extensions
{
    public static class ParseExt
    {
        public static int? TryParseInt(this string @this)
        {
            if (int.TryParse(@this, out var value))
                return value;
            else
                return null;
        }

        public static double? TryParseDouble(this string @this)
        {
            if (double.TryParse(@this, out var value))
                return value;
            else
                return null;
        }

        public static DateTime? TryParseDateTime(this string @this)
        {
            if (DateTime.TryParse(@this, out var value))
                return value;
            else
                return null;
        }
    }
}
